#! /bin/bash
# modify password
#v1.0 by wangtao 2019/01/14
>ok_`date +%F`.txt
>fail_`date +%F`.txt

read -p "请输入密码:" pass

for ip in `cat ip.txt`
do
	{
		ping -c1 -W1 $ip &>/dev/null
		if [ $? -eq 0 ];then
			ssh $ip "echo $pass | passwd --stdin wangtao"
			if [ $? -eq 0 ];then
				echo "$ip" >>ok_`date +%F`.txt
			else
				echo "$ip" >>fail_`date +%F`.txt
			fi
		else
			echo "$ip" >>fail_`date +%F`.txt	
		fi
	
	}&
done
wait
echo "finish..."
